/**
 * 
 */
package com.anxin.common.utils;

import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;

/**
 * @author sj
 *
 */
public class SimpleHttpClientManager {

	private static class SingletonPoolManager {
		private static final int maxTotal = 100;
		public final static PoolingHttpClientConnectionManager poolHttpClient = new PoolingHttpClientConnectionManager();
		static {
			poolHttpClient.setMaxTotal(maxTotal);
		}
	}

	private static PoolingHttpClientConnectionManager getInstance() {
		return SingletonPoolManager.poolHttpClient;
	}

	public static CloseableHttpClient getCloseableHttpClient(){
		return HttpClients.custom().setConnectionManager(SimpleHttpClientManager.getInstance()).build();
	}
	

}
